﻿/**  
* TallyAfter.cs
*
* 功 能： N/A
* 类 名： TallyAfter
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2014/1/25 22:04:59   N/A    初版
*
* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
*┌──────────────────────────────────┐
*│　此技术信息为本公司机密信息，未经本公司书面同意禁止向第三方披露．　│
*│　版权所有：动软卓越（北京）科技有限公司　　　　　　　　　　　　　　│
*└──────────────────────────────────┘
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DataLib.DBUtility;

namespace DataLib.DAL
{
    /// <summary>
    /// 数据访问类:TallyAfter
    /// </summary>
    public partial class TallyAfter
    {

        // <summary>
        /// 返回与Tally连接查询的列表
        /// </summary>
        public DataSet Getdata()
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Tally.LoadNo,Tally.OperDate,TallyAfter.goosdname,TallyAfter.nt,TallyAfter.qty from TallyAfter join Tally on Tally.id=TallyAfter.Tallyid");

            DataLib.Model.TallyAfter model = new DataLib.Model.TallyAfter();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            return ds;
        }

        /// <summary>
        /// 返回查询汇总的列表
        /// </summary>
        public DataSet GetSumdata()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select goosdname,sum(nt) nt,SUM(qty) qty from TallyAfter group by goosdname");
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            return ds;
        }

        /// <summary>
        /// 根据条件删除
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public bool dellist(string where)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from TallyAfter where ");
            strSql.Append(where);
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

